package com.atguigu.guli.service.trade.controller.api;

import com.atguigu.guli.service.base.result.R;
import com.atguigu.guli.service.trade.service.EduFeignClient;
import com.atguigu.guli.service.trade.service.OrderService;
import com.atguigu.guli.service.trade.service.PayLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/api/trade/wx")
public class ApiWxPayController {
    @Autowired
    OrderService orderService;
    @Autowired
    PayLogService payLogService;
    @Autowired
    EduFeignClient eduFeignClient;
    //2、用户支付成功wx回调的接口
    @PostMapping("notifyurl")
    public String notifyUrl(HttpServletRequest request){
        String returnXmlStr = orderService.nofityurl(request);
        return returnXmlStr;
    }

    //1、在订单详情页点击 去支付按钮 生成wx支付二维码
    @GetMapping("auth/createNative/{orderId}")
    public R createNative(@PathVariable String orderId,
                          HttpServletRequest request){
        R r = orderService.createNative(orderId , request);
        return r;
    }

}
